export function getYoutubeIdByUrl(url: string) {
  const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/;
  const match = url.match(regExp);

  return match && match[2].length === 11 ? match[2] : null;
}
export function getYoutubeEmbedUrl(str: string) {
  const id = getYoutubeIdByUrl(str);
  if (id) {
    return `//www.youtube.com/embed/${id}`;
  } else {
    return `//www.youtube.com/embed/${str}`;
  }
}
